/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-05-24     甘泽       the first version
 */
#ifndef APPLICATIONS__SENSOR_H_
#define APPLICATIONS__SENSOR_H_

#define SENSOR_THREAD_STACK_SIZE (1024 * 10)
#define SENSOR_THREAD_PRIORITY 4
#define SENSOR_THREAD_TICK 20

#define GRAVITY 9.81f /* 重力加速度9.81m/s^2 */
#define RAD2DEG 57.3f /* 1rad = 57.3° */

#include <stdint.h>

union sensor_data_union
{
    struct
    {
        float x;
        float y;
        float z;
    } acce;
    struct
    {
        float x;
        float y;
        float z;
    } gyro;
    struct
    {
        float x;
        float y;
        float z;
    } mag;
    struct
    {
        float longitude;
        float latitude;
        float height;
    } pos;
};

typedef struct sensor_data
{
    unsigned int timestamp;
    union sensor_data_union data;
} sensor_data_t;

struct sensor_info
{
};

#define ACCEL_SENSOR_RESOLUTION 0.001f
#define GYRO_SENSOR_RESOLUTION 0.001f
#define MAG_SENSOR_RESOLUTION 0.001f

/// @brief 开启传感器工作线程
/// @param
/// @return
int start_sensor_thread(void);

/// @brief 高度
/// @param height
/// @return
int get_height_value(float *height);

/// @brief
/// @param temp
/// @return
int get_temp_value(int *temp);

/// @brief
/// @param baro
/// @return
int get_baro_value(uint32_t *baro);
#endif /* APPLICATIONS__SENSOR_H_ */
